package com.pyue.eam.admin.controller;

import com.aizuda.limiter.annotation.RateLimit;
import com.aizuda.limiter.strategy.IpKeyGenerateStrategy;
import com.pyue.eam.admin.api.constant.ResponseWord;
import com.pyue.eam.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@RequestMapping
public class PingController {

    @Inner(value = false)
    @GetMapping("/ping")
    @Tag(description = "ping", name = "ping")
    @RateLimit(count = 1, interval = "3s", strategy = {IpKeyGenerateStrategy.TYPE}, message = ResponseWord.WAIT_TIME)
    public String ping() {
        return "pong";
    }

}
